# -*- coding: utf-8 -*-                                     #0
"""                                                         #1
Created on Tue Oct 31 19:46:22 2023                         #2
                                                            #3
@author: 楠川之木                                             #4
"""                                                         #5
                                                            #6
filename = 'demo6.py'                                       #7
with open(filename, 'r') as fp:                             #8
    lines = fp.readlines()                                  #9
maxLength = len(max(lines, key=len))                        #10
lines = [line.rstrip().ljust(maxLength)+'#'+str(index)+'\n' #11
         for index, line in enumerate(lines)]               #12
with open(filename[:-3]+'_new.py', 'w') as fp:              #13
    fp.writelines(lines)                                    #14
